Skip to content

创建项目

搭建脚手架

	安装脚手架: 	$ npm i @vue/cli -g
	
	查看当前版本	$ vue --version
	创建项目文件	$ vue create 项目名
	自定义目录:	( * ) Choose Vue version
				( * ) Babel
				(   ) TypeScript
				(   ) Progressive Web App (PWA) Support
				( * ) Router
				( * ) Vuex
				( * ) CSS Pre-processors
				( * ) Linter / Formatter
				(   ) Unit Testing
				(   ) E2E Testing
	定义ESLint   ESLint + Prettier
	路由器设置:	-n

移动端适配

​ 使用postcss-pxtorem(单位换算)和amfe-flexible(定义跟字体大小)

	安装单位换算插件	cnpm i postcss-pxtorem@5.1.1 -D
	安装定义字号插件	cnpm i amfe-flexible -S
	main.js中引入	   import "amfe-flexible"
	根目录创建文件.postcssrc.js

  module.exports = {
    plugins: {
      'postcss-pxtorem': {
        rootValue: 37.5,
        propList: ['*'],
      },
    },
  };

运行脚手架

	编译和热加载用于开发		npm run serve
	编译和最小化产品    	 npm run build
	检查和修复文件			  npm run lint